//
//  BaseScrollView.m
//  
//
//  Created by lanou on 15/12/18.
//
//

#import "BaseScrollView.h"

@implementation BaseScrollView

- (instancetype)initWithFrame:(CGRect)frame{
    
    self = [super initWithFrame:frame];
    if (self) {
        self.pagingEnabled = YES;
        self.contentSize = CGSizeMake(kWidth *2, 0);
        //创建一个布局对象
        UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc]init];
        //列距
        flowLayout.minimumInteritemSpacing = 10;
        //行距
        flowLayout.minimumLineSpacing = 10;
        //分区内边距
        flowLayout.sectionInset = UIEdgeInsetsMake(5, 5, 5, 5);
        //itemSize 设置为一行两列
        CGFloat itemWidth = (kWidth - 10 - 10) / 2;
        flowLayout.itemSize = CGSizeMake(itemWidth, itemWidth);
        flowLayout.scrollDirection = UICollectionViewScrollDirectionVertical;
        self.pictureCollectionView = [[UICollectionView alloc]initWithFrame:(CGRectMake(0, 0, kWidth, kHeight)) collectionViewLayout:flowLayout];
        self.pictureCollectionView.backgroundColor = [UIColor whiteColor];
        [self addSubview:self.pictureCollectionView];
        
        self.photoTablleView = [[UITableView alloc]initWithFrame:(CGRectMake(kWidth, 0, kWidth, kHeight)) style:(UITableViewStylePlain)];
        [self addSubview:self.photoTablleView];
        
        
    }
    return self;
}









/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
